# -*- coding: utf-8 -*-
"""
@Author: thekernel
@Date: 2020/6/23 14:35
@Description: 
"""
from appium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
import requests

cap = {
    "platformName": "Android",
    "platformVersion": "5.1.1",
    "deviceName": "127.0.0.1:62001",  # adb模拟器地址
    "appPackage": "com.tal.kaoyan",
    "appActivity": "com.tal.kaoyan.ui.activity.SplashActivity",
    "noReset": True
}

driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", cap)

# 广告页面 点击跳过
try:
    skip_button = driver.find_element_by_xpath("//android.widget.TextView[@resource-id='com.tal.kaoyan:id/tv_skip']")
    if WebDriverWait(driver, 3).until(skip_button):
        skip_button.click()
except Exception:
    pass
